#include "los_swtmr.h"
#include "stdio.h"
#include <stdint.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "utils_file.h"
UINT32 g_soft_time_id;
uint8_t g_count=0;

VOID soft_timer_callback_func(UINT32 para)
{
    printf("para - %d\n",para);
    printf("soft_timer_callback_func %d\n",++g_count);

    if(g_count > para)
    {
        LOS_SwtmrStop(g_soft_time_id);
    }
}

void soft_time_demo()
{
    
    printf(">>>>>>soft_time_demo Start \n");
    UINT32 ret = LOS_SwtmrCreate(500,LOS_SWTMR_MODE_PERIOD,soft_timer_callback_func,&g_soft_time_id,6);

    if(ret != LOS_OK)
    {
        printf("soft timer Create ret=%d\n");
        return;
    }
    printf("soft timer creat ok\n");
    ret = LOS_SwtmrStart(g_soft_time_id);
    if(ret != LOS_OK)
    {
        printf("soft timer Start ret=%d\n");
        return;
    }
    printf("soft timer Start ok\n");
}